package com.ilancuo.string;

/** 测试字符串长度
 *
 * Created by ilancuo on 2016/12/21.
 */
public class StringLength {

    public static void main(String... args) {
        String s = "abcdef";
        System.out.println(s.substring(1, s.length() - 1));; //bcde,包括第一个和不包括最后一个

        String date = "2015-12-21";
        System.out.println(date.substring(0, 10)); //2015-12-21

        String string = "abc,";
        System.out.println(string.substring(0, string.length() - 1)); //abc
        System.out.println(string.lastIndexOf("c")); //2
    }
}
